package com.neusoft.neumooc.controller.front;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.neusoft.core.common.BaseController;
import com.neusoft.core.common.conf.Params;
import com.neusoft.neumooc.service.front.MenuService;
import com.neusoft.neumooc.vo.MenuVO;


/** 
 * @ClassName: MenuFrontController 
 * @Description: TODO 头部导航管理控制类
 * @author huangruijin
 * @date 2016年8月26日
 */
@RequestMapping(value = "/menufront")
@Controller
public class MenuFrontController extends BaseController {

	/**
	 * @Fields menuService : TODO 导航业务逻辑处理类
	 */
	@Autowired
	MenuService menuService;
	
	/**
	 * @Title: getMenuList
	 * @Description: TODO 获取一级导航和二级导航
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "menuList")
	public Map<String, Object> getMenuList(HttpServletRequest request) {
		Map<String, Object> retMap = new HashMap<String, Object>();
		try {
			// 一级导航信息
			List<MenuVO> oneMenuList = menuService.getOneMenuList();
			// 二级导航信息
			List<MenuVO> twoMenuList = menuService.getTwoMenuList();

			retMap.put("oneMenuList", oneMenuList);
			retMap.put("twoMenuList", twoMenuList);
			return retMap;
		} catch (Exception e) {
			log.debug("【导航信息】功能获取导航列表出现异常" + e);
			retMap.put(Params.RET_MSG, "获取导航列表出现异常！");
			return retMap;
		}
	}
	
}
